There are three main features which let you control the layout of the code.
Using
in the submenu of the HTML menu, you can specify the layout you want for each HTML element. Alpha then uses your settings when it inserts new tags in the document, and when it otherwise reformats the code. The possible options differ between element with and without a closing tag.For elements without a closing tag you can specify if you always want a carriage return inserted before and/or after the tag. If you check both checkboxes in the dialog, Alpha will format the code like this:
some text before the tag
<TAG>
some text after the tag
For elements with a closing tag, you have four different options letting you specify if you want the tags to be on lines of their own and if you want blank lines before and after them.
With the first option Alpha will format the code like this:
some text before the tag <TAG>text between tags</TAG> some text after the tag
With the second option Alpha will format the code like this:
some text before the tag
<TAG>text between tags</TAG>
some text after the tag
With the third option Alpha will format the code like this:
some text before the tag
<TAG>text between tags</TAG>
some text
after the tag
With the fourth option Alpha will format the code like this:
some text before the tag
<TAG>
text between tags
</TAG>
some text
after the tag
Alpha indents the HTML code to make easier to read. Using
in the submenu, you can choose which elements whose content should be indented. By default the content of lists and tables is indented. The element which you can indent the content of are those with a closing tag, which you have specified the fourth layout above.
some text before the tag
<TAG>
text between tags
</TAG>
some text
after the tag
Below is an example of how the code is indented. Whenever Alpha inserts new tags in the document or otherwise reformats the code, it recognizes your indentation preferences.
Reformat Document
The reformatting is basically done such that the document would look as if you have typed it from top to bottom without changing anything. The following is done:
Unfortunately reformatting of the code is rather complex and therefore not lightning fast.
<!-- #NO-FORMATTING -->
some text which should left untouched
<!-- /#NO-FORMATTING -->
<!-- #C-FORMATTING --> if (a == 17) { return; } <!-- /#C-FORMATTING -->
You can define your own formatting tags. See the power user section.